package leetcode;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2022-02-14
 * Time: 10:44
 */
public class Day_01 {
    public static void main(String[] args) {

    }
}

class Solution {
    public int singleNonDuplicate(int[] nums) {
      int min=0,max=nums.length-1;
      while(min<max){
          int mid=(min+max)/2; //或者写成（max-min）/2+min
          if(nums[mid]==nums[mid^1]){
              min=mid+1;
          }
          else{
              max=mid;
          }
      }
      return nums[min];
    }
}




